#ifndef BUTTON_WIN_H
#define BUTTON_WIN_H

#include <QWidget>
#include <QPushButton>
#include <QVBoxLayout>
#include <windows.h>
#include <QtWin>
#include <QDebug>
#include "mbutton.h"
#include "add_http.h"
#include <QContextMenuEvent>
#include <QDesktopServices>

#include "config.h"

namespace Ui {
class Button_Win;
}

class Button_Win : public QWidget
{
    Q_OBJECT

public:
    explicit Button_Win(QWidget *parent = nullptr);
    ~Button_Win();

    MButton * addbutton(QString text);

    void set_list(QList <liststr> list_p);
    QList <liststr> get_list();

    void set_winname(QString name);

    QString get_winname();

    void Button_Win_init();

private:
    Ui::Button_Win *ui;
    QVBoxLayout *mainLayout = nullptr;
    QSpacerItem *topSpacer = nullptr;
    QString win_name;

    QList <liststr> list;



    QIcon GetIcon(QString const& fileName, int index = 0);

    void nullbutt_tool_fun(MButton *butt);
    void nullbutt_fun(MButton *butt);

    void set_button(MButton *butt,liststr str);

    void run_exe(QString filefath);
    void open_http(QString httppath);

private slots:
    void button_slot(MButton *);

    void right_button_slot(MButton *);
};

#endif // BUTTON_WIN_H
